export const useHistory = () => {
	const getDialogTitle = (prefix: string, name?: string) => {
		if (name) {
			return `${prefix} - ${name}`;
		} else {
			return prefix;
		}
	};
	//字典数据
	const dictDialog = reactive<any>({
		title: getDialogTitle(`字典配置`),
		dataValue: null,
		dataKey: "",
		detail: {
			devSn: ""
		},
		visible: false
	});
	//历史数据
	const dataChartDialog = reactive<any>({
		title: getDialogTitle(`历史数据趋势`),
		dataValue: null,
		dataKey: "",
		detail: {
			devSn: ""
		},
		visible: false
	});
	//历史图片
	const imgDialog = reactive<any>({
		title: getDialogTitle(`历史图片`),
		dataKey: "",
		detail: {
			devSn: ""
		},
		visible: false
	});
	//文件
	const fileDialog = reactive<any>({
		title: getDialogTitle(`文件列表`),
		detail: {
			devSn: ""
		},
		dataKey: "",
		visible: false
	});
	const locationDialog = reactive({
		visible: false,
		dataKey: "",
		detail: { devSn: "", location: { lat: null, lng: null, address: null } },
		title: getDialogTitle("位置与轨迹")
	});
	const alarmDataDialog = reactive<any>({
		title: getDialogTitle(`告警记录`),
		dataValue: null,
		dataKey: "",
		detail: {
			devSn: ""
		},
		visible: false
	});
	const configAlarmDialog = reactive({
		visible: false,
		detail: {
			devSn: ""
		},
		title: getDialogTitle("告警配置")
	});
	const videoDialog = reactive({
		videoUrl: "",
		visible: false,
		detail: {
			devSn: ""
		},
		title: getDialogTitle("实时视频")
	});
	return {
		getDialogTitle,
		dataChartDialog,
		imgDialog,
		fileDialog,
		locationDialog,
		configAlarmDialog,
		alarmDataDialog,
		videoDialog,
		dictDialog
	};
};
